package com.apes.framework.util.statistics;

import com.apes.framework.util.DateUtil;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 功能：
 *
 * @author xul
 * @create 2017-12-18 19:05
 */
@Data
@Document(indexName = "logs-statistics_" + "#{esIndexName.indexName}", replicas = 0)
public class Statistics {

    @Id  // 主键
    private String id; //消息编号
    private String server;
    private String method;
    private String version;
    private String appKey;
    private String sessionId;
    private String userId;
    private String postId;
    private String ip;
    private String beginTime;
    private String endTime;
    private long time; //耗时(毫秒)
    private String request; //请求数据
    private String response; //响应数据
    private String tags;

    /**
     * 创建时间
     **/
    @Field(type = FieldType.Date)
    private String createdOn = DateUtil.format("yyyy-MM-dd'T'HH:mm:ss.SSS") + "+0800";

    private String invokeMethod;    // 用于记录 Pi 调用接口使用

    private String queryDecoder;  // 转码App查询参数

    private long createdOnTimeStamp;
    private long endOnTimeStamp;
}



